// pages/demo1/demo1.js
Page({
  data: {
    list: [
      {
        id: 1,
        name: "首页",
        isActive: true,
      },
      {
        id: 2,
        name: "文章",
        isActive: false,
      },
      {
        id: 3,
        name: "内容",
        isActive: false,
      },
      {
        id: 4,
        name: "其他",
        isActive: false,
      },
    ],
    isLoading:false
  },
  handleIndexChange(e) {
    const { index } = e.detail;
    let { list } = this.data;
    list.forEach((v, i) => (v.isActive = i === index));
    this.setData({
      list,
    });
  },
  onLoad: function (options) {
    //Do some initialize when page load.
  },
  onShow: function () {
    //Do some when page show.
    console.log("页面加载");
  },
  onReady: function () {
    //Do some when page ready.
    console.log("页面加载完成");
  },
  onHide: function () {
    //Do some when page hide.
  },
  onUnload: function () {
    //Do some when page unload.
  },
  onPullDownRefresh: function () {
        this.setData({
                isLoading:true
        })
    //Do some when page pull down.
    console.log("开启了页面刷新");
    setTimeout(()=>{
        this.setData({
                isLoading:false
        })
            wx.stopPullDownRefresh()
    },1000)
  },
  onResize(){
          console.log("屏幕切换");
  }
});
